<template>
  <div>
    <div class="product-item">
      <div class="product-img">
        <!--图片-->
        <router-link :to="{path: '/detail', query: {goodsId: product.id}}" target="_blank">
          <img v-lazy="product.icon1" :alt="product.goods_name" :title="product.goods_name" imgtype='commodity'/>
        </router-link>
      </div>
      <p class="product-title">
        <router-link :to="{path: '/detail', query: {goodsId: product.id}}" target="_blank">{{ product.goods_name }} {{ product.type_name }} {{ product.sx_name }}</router-link>
      </p>
      <!--价格-->
      <template v-if="product.base_price > 200">
      <p class="product-total-price">{{$t('message.currencySymbol')}}{{ product.base_price }}</p>
      <p class="product-installment">
        <span class="product-installment-text" :title="`${$t('message.currencySymbol')}${product.base_price}X ${product.stages}${$t('message.time')}`">
          {{$t('message.currencySymbol')}}<span class="product-installment-price">{{ product.staging_price }}</span>X {{product.stages}}{{$t('message.time')}}
        </span>
        <router-link :to="{path: '/detail', query: {goodsId: product.id}}" class="buy-now" target="_blank">{{$t('message.buyNow')}}</router-link>
      </p>
      </template>
      <template v-else>
        <!-- <p class="product-total-price"></p>
        <p class="product-installment">{{$t('message.currencySymbol')}}<span class="product-installment-price">{{ product.base_price }}</span></p> -->
        <p class="product-total-price no-line">&nbsp;</p>
        <p class="product-installment">
          <span class="product-installment-text" :title="$t('message.currencySymbol') + product.base_price">
            {{$t('message.currencySymbol')}}<span class="product-installment-price">{{ product.base_price }}</span>
          </span>
          <router-link :to="{path: '/detail', query: {goodsId: product.id}}" class="buy-now" target="_blank">{{$t('message.buyNow')}}</router-link>
        </p>
      </template>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'VProductItem',
    props: {
      product: {
        type: Object,
        require: true
      }
    }
  }
</script>

<style scoped>
.product-item {
}

.product-img {
  width: 138px;
  height: 138px;
  margin: 0 auto;
}

.product-img img {
  width: 100%;
  height: 100%;
}

.product-title {
  height: 40px;
  font-size: 14px;
  color: #333;
  line-height: 20px;
  margin-top: 16px;
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-title a {
  color: #333;
  font-size: 14px;
}

/* .product-title a:hover {
  color: #FF600A;
  text-decoration: underline;
} */

.product-total-price {
  height: 20px;
  line-height: 20px;
  font-size: 14px;
  color: #676767;
  text-decoration: line-through;
  margin-top: 8px;
}

.no-line {
  text-decoration: none;
}

.product-installment {
  height: 53px;
  width: 232px;
  line-height: 53px;
  font-size: 12px;
  color: #ff600a;
  margin-top: 14px;
  margin-left: -16px;
  background-color: #FFF7F2;
}

.product-installment-price {
  font-size: 20px;
  line-height: 33px;
  padding: 0 6px 0 2px;
}

.product-installment-text {
  float: left;
  width: 130px;
  margin-left: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.buy-now {
  float: right;
  margin: 12px 0;
  margin-right: 16px;
  padding: 0px 8px;
  font-size: 12px;
  color: #fff;
  line-height: 27px;
  background-image: linear-gradient(-90deg, #FFB63A 0%, #FF8118 100%);
  border-radius: 2px;
}

.buy-now:hover {
  background-image: linear-gradient(-90deg, #FFA13A 0%, #FF6418 100%);
}
</style>
